from Yuekao.Base.Base import Base
from selenium.webdriver.common.by import By

class Page(Base):

    # 定位器
    # 搜索框
    search_input = (By.ID,'chat-textarea')
    # 封装搜索框输入
    def send_search(self):
        self.send_keys(self.search_input,'web自动化')
    # 搜索按钮
    search_button = (By.XPATH,'/html/body/div[1]/div[1]/div[6]/div/div/div[2]/div/div/div[1]/div/div[1]/div[4]/div[1]/div[3]/div[3]/button')
    # 封装点击搜索按钮
    def click_search(self):
        self.click(self.search_button)
    # 新闻文本
    news_text = (By.XPATH,'/html/body/div[1]/div[1]/div[3]/a[1]')
    # 封装点击新闻文本
    def click_news(self):
        self.click(self.news_text)
        self.new_window()
    # 热搜新闻
    hot_text = (By.CSS_SELECTOR,'#news-hotwords > div.bd > ul > li.li_0.li_color_0.button-slide > a')
    # 封装点击热搜
    def click_hot(self):
        self.click(self.hot_text)
        self.new_window()
    # 进入详情
    more_text = (By.XPATH,'/html/body/div[3]/div[4]/div[1]/div[3]/div[1]/div/div/div/div/div/div[2]/h3/a/span/em')
    # 封装点击详情
    def click_more(self):
        self.click(self.more_text)
        self.new_window()